<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Door_control_dll: Door_control_dll.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Door_control_dll
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">Door_control_dll.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;windows.h&gt;</code><br/>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;time.h&gt;</code><br/>
<code>#include &lt;string&gt;</code><br/>
<code>#include &lt;boost/interprocess/sync/interprocess_mutex.hpp&gt;</code><br/>
<code>#include &lt;boost/interprocess/sync/scoped_lock.hpp&gt;</code><br/>
<code>#include &quot;ftdi2xx.h&quot;</code><br/>
</div>
<p><a href="_door__control__dll_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdoor__control__device.html">door_control_device</a></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a03d94e56164bec682d9470223c262b01"></a><!-- doxytag: member="Door_control_dll.h::DllMain" ref="a03d94e56164bec682d9470223c262b01" args="(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)" -->
BOOL WINAPI __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>DllMain</b> (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a518a8d4c86b4ba2cfc9d37e9a8773eab">door_control_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization.  <a href="#a518a8d4c86b4ba2cfc9d37e9a8773eab"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a75444cf6384e550986a362f5fc33e18f">door_control_dev_if_mode</a> (int mode)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set interface mode.  <a href="#a75444cf6384e550986a362f5fc33e18f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7b4d864b03978d51385b012b424cdb90"></a><!-- doxytag: member="Door_control_dll.h::set_read_buff_after_writing" ref="a7b4d864b03978d51385b012b424cdb90" args="(int inp_val)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>set_read_buff_after_writing</b> (int inp_val)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a9c4ffa4d06a7a396bf711fd497fd783c">door_control_ser_set_name</a> (const char *ser_port_name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set serial port name.  <a href="#a9c4ffa4d06a7a396bf711fd497fd783c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a6ce1cce93c0e443449790a3e5460ee52">door_control_ser_set_num</a> (int port_no)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set serial port name by port number.  <a href="#a6ce1cce93c0e443449790a3e5460ee52"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#ad779394bb01db061be3f30f8de27f669">door_control_dev_open</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens serial port or FTDI device and checks device type.  <a href="#ad779394bb01db061be3f30f8de27f669"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#abe12fbc36eec84c9cbc84e994a19c99b">door_control_ft_get_driver_version</a> (unsigned int *ft_drv_ver)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get FTDI driver version.  <a href="#abe12fbc36eec84c9cbc84e994a19c99b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a168eaa2f6293786ea02c899945e3c5d0">door_control_ft_get_library_version</a> (unsigned int *ft_lib_ver)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get D2XX library version.  <a href="#a168eaa2f6293786ea02c899945e3c5d0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#ad30cbc8f0c0b51932180f469952eecc1">door_control_ser_open</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens serial port.  <a href="#ad30cbc8f0c0b51932180f469952eecc1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a6b2909ec14a5aeec9b6036e1670e6cf6">door_control_set_brd_ver</a> (char board_version)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set board version.  <a href="#a6b2909ec14a5aeec9b6036e1670e6cf6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a6078917b7fc198559dd7b78b5ca814f5">door_control_get_brd_ver</a> (char *board_version)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns board version.  <a href="#a6078917b7fc198559dd7b78b5ca814f5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a25c54211a4b569ae9737ae0f271efa14">door_control_set_ser_no</a> (char *buf)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set serial No.  <a href="#a25c54211a4b569ae9737ae0f271efa14"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a4d256a4e1081b16b37b19ad0bfe0fb28">door_control_get_ser_no</a> (char *buf, int buf_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns serial No.  <a href="#a4d256a4e1081b16b37b19ad0bfe0fb28"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#ae3b527c0dc8ba629b1f519b38a1577f4">door_control_get_fwv</a> (char *buf, int buf_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns firmware version.  <a href="#ae3b527c0dc8ba629b1f519b38a1577f4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9bb20b807650412a83262b580f53e2fa"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_set_baud" ref="a9bb20b807650412a83262b580f53e2fa" args="(int baud)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_ser_set_baud</b> (int baud)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3f3fe8f7ecbbedf0607eb907b158e1f9"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_get_baud" ref="a3f3fe8f7ecbbedf0607eb907b158e1f9" args="(void)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_ser_get_baud</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2c190c5d7042d961a634382488c565e1"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_read_buf" ref="a2c190c5d7042d961a634382488c565e1" args="(char *buf, int *n_recv, int size)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_ser_read_buf</b> (char *buf, int *n_recv, int size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a177b036effb10eba43dc86db6225e8ed"></a><!-- doxytag: member="Door_control_dll.h::door_control_leds_set" ref="a177b036effb10eba43dc86db6225e8ed" args="(int led_No, int led_state)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_leds_set</b> (int led_No, int led_state)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8755160a87cfbbcb0d1a0eeef3d44fe8"></a><!-- doxytag: member="Door_control_dll.h::door_control_get_sum" ref="a8755160a87cfbbcb0d1a0eeef3d44fe8" args="(int a, int b, int *sum)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_get_sum</b> (int a, int b, int *sum)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a664e43f29f02103b4f8afdcfcaa15bd9">door_control_lock_set</a> (int state)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens or closes the lock.  <a href="#a664e43f29f02103b4f8afdcfcaa15bd9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a11bc1420a48bdb3dd5e2c2287158060b">door_control_inps_get</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get state of the inputs.  <a href="#a11bc1420a48bdb3dd5e2c2287158060b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#a69c549adcf652634a994e8cd669c4a00">door_control_modem_reset</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset modem.  <a href="#a69c549adcf652634a994e8cd669c4a00"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd82abffc52fab294d30fb3719c5eb04"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_close" ref="acd82abffc52fab294d30fb3719c5eb04" args="(void)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_ser_close</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_door__control__dll_8h.html#abaa08b23b8679de091443218b32683f7">door_control_finish</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Finalization.  <a href="#abaa08b23b8679de091443218b32683f7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad6b2fba3a9d5f48105c36ed43084d405"></a><!-- doxytag: member="Door_control_dll.h::door_control_d2xx_dll_open" ref="ad6b2fba3a9d5f48105c36ed43084d405" args="(void)" -->
int __stdcall&#160;</td><td class="memItemRight" valign="bottom"><b>door_control_d2xx_dll_open</b> (void)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1300c6e4abb91d5c48877fc366c195e6"></a><!-- doxytag: member="Door_control_dll.h::dll_handle" ref="a1300c6e4abb91d5c48877fc366c195e6" args="" -->
HINSTANCE&#160;</td><td class="memItemRight" valign="bottom"><b>dll_handle</b></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"></div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a75444cf6384e550986a362f5fc33e18f"></a><!-- doxytag: member="Door_control_dll.h::door_control_dev_if_mode" ref="a75444cf6384e550986a362f5fc33e18f" args="(int mode)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a75444cf6384e550986a362f5fc33e18f">door_control_dev_if_mode</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>mode</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set interface mode. </p>
<p>select device interface mode: Virtual Communication Port or D2XX interface</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">int</td><td>mode<ul>
<li>1 - VCP mode (serial port)</li>
<li>2 - D2XX mode</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - incorrect mode </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="ad779394bb01db061be3f30f8de27f669"></a><!-- doxytag: member="Door_control_dll.h::door_control_dev_open" ref="ad779394bb01db061be3f30f8de27f669" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#ad779394bb01db061be3f30f8de27f669">door_control_dev_open</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Opens serial port or FTDI device and checks device type. </p>
<p>port name has to be set before by <a class="el" href="_door__control__dll_8h.html#a9c4ffa4d06a7a396bf711fd497fd783c" title="Set serial port name.">door_control_ser_set_name(const char *s)</a>, mode has to be selected if D2XX used, see <a class="el" href="_door__control__dll_8h.html#a75444cf6384e550986a362f5fc33e18f" title="Set interface mode.">door_control_dev_if_mode(int mode)</a></p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>
0 - OK </li>
<li>
7 - incorrect dev_interface_mode </li>
</ul>
if mode is serial <ul>
<li>
1 - failed CreateFile </li>
<li>
2 - failed SetCommState </li>
<li>
3 - failed device type check </li>
</ul>
if mode is d2xx <ul>
<li>
1 - incorrect serial port name </li>
<li>
2 - unable to get FTDI info </li>
<li>
3 - unable to get corresponding serial port nnumber </li>
<li>
4 - unable to get handle </li>
<li>
5 - FTDI devices not found </li>
</ul>
any mode <ul>
<li>
bit 4 is set - unable to read port </li>
<li>
bit 5 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="abaa08b23b8679de091443218b32683f7"></a><!-- doxytag: member="Door_control_dll.h::door_control_finish" ref="abaa08b23b8679de091443218b32683f7" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#abaa08b23b8679de091443218b32683f7">door_control_finish</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Finalization. </p>
<p>close port and free resources</p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="abe12fbc36eec84c9cbc84e994a19c99b"></a><!-- doxytag: member="Door_control_dll.h::door_control_ft_get_driver_version" ref="abe12fbc36eec84c9cbc84e994a19c99b" args="(unsigned int *ft_drv_ver)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#abe12fbc36eec84c9cbc84e994a19c99b">door_control_ft_get_driver_version</a> </td>
          <td>(</td>
          <td class="paramtype">unsigned int *&#160;</td>
          <td class="paramname"><em>ft_drv_ver</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get FTDI driver version. </p>
<p>device has to be opened before this function can be called see <a class="el" href="_door__control__dll_8h.html#ad779394bb01db061be3f30f8de27f669" title="Opens serial port or FTDI device and checks device type.">door_control_dev_open()</a>;</p>
<p>A version number consists of major, minor and build version numbers contained in a 4-byte field (unsigned long). Byte0 (least significant) holds the build version, Byte1 holds the minor version, Byte2 holds the major version. Byte3 is currently set to zero. For example, driver version "2.04.06" is represented as 0x00020406.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">unsigned</td><td>int * Pointer to the driver version number</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - device not opened</li>
<li>-ft_status - unable to get driver version </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a168eaa2f6293786ea02c899945e3c5d0"></a><!-- doxytag: member="Door_control_dll.h::door_control_ft_get_library_version" ref="a168eaa2f6293786ea02c899945e3c5d0" args="(unsigned int *ft_lib_ver)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a168eaa2f6293786ea02c899945e3c5d0">door_control_ft_get_library_version</a> </td>
          <td>(</td>
          <td class="paramtype">unsigned int *&#160;</td>
          <td class="paramname"><em>ft_lib_ver</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get D2XX library version. </p>
<p>A version number consists of major, minor and build version numbers contained in a 4-byte field (unsigned long). Byte0 (least significant) holds the build version, Byte1 holds the minor version, and Byte2 holds the major version. Byte3 is currently set to zero. For example, D2XX DLL version "3.01.15" is represented as 0x00030115.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">unsigned</td><td>int * Pointer to the library version number</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - library not initialized</li>
<li>-ft_status - unable to get driver version </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a6078917b7fc198559dd7b78b5ca814f5"></a><!-- doxytag: member="Door_control_dll.h::door_control_get_brd_ver" ref="a6078917b7fc198559dd7b78b5ca814f5" args="(char *board_version)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a6078917b7fc198559dd7b78b5ca814f5">door_control_get_brd_ver</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>board_version</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns board version. </p>
<p>port has to be opened</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">char</td><td>* board_version - board version</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>bit 0 is set - unable to write into port</li>
<li>bit 1 is set - unable to read port</li>
<li>bit 2 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="ae3b527c0dc8ba629b1f519b38a1577f4"></a><!-- doxytag: member="Door_control_dll.h::door_control_get_fwv" ref="ae3b527c0dc8ba629b1f519b38a1577f4" args="(char *buf, int buf_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#ae3b527c0dc8ba629b1f519b38a1577f4">door_control_get_fwv</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>buf_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns firmware version. </p>
<p>port has to be opened</p>
<p>format: fw  door_control  01_ed_01 </p>
<dl class="date"><dt><b>Date:</b></dt><dd>2012_07_26_01 here<ul>
<li>door_control - type of device</li>
<li>01_ed_01 - firmware version</li>
<li>2012_07_26_01 - compilation date</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">char</td><td>* buf - input buffer, 63 is enough </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">int</td><td>buf_len - size of buf</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>bit 0 is set - unable to write into port</li>
<li>bit 1 is set - unable to read port</li>
<li>bit 2 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a4d256a4e1081b16b37b19ad0bfe0fb28"></a><!-- doxytag: member="Door_control_dll.h::door_control_get_ser_no" ref="a4d256a4e1081b16b37b19ad0bfe0fb28" args="(char *buf, int buf_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a4d256a4e1081b16b37b19ad0bfe0fb28">door_control_get_ser_no</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>buf_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns serial No. </p>
<p>port as to be opened</p>
<p>example: 1234</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">char</td><td>* buf - input buffer, 4 is enough </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">int</td><td>buf_len - size of buf</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>bit 0 is set - unable to write into port</li>
<li>bit 1 is set - unable to read port</li>
<li>bit 2 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a518a8d4c86b4ba2cfc9d37e9a8773eab"></a><!-- doxytag: member="Door_control_dll.h::door_control_init" ref="a518a8d4c86b4ba2cfc9d37e9a8773eab" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a518a8d4c86b4ba2cfc9d37e9a8773eab">door_control_init</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialization. </p>
<p>should be called first</p>
<p>int <a class="el" href="_door__control__dll_8h.html#a518a8d4c86b4ba2cfc9d37e9a8773eab" title="Initialization.">door_control_init(void)</a>;</p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - failed </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a11bc1420a48bdb3dd5e2c2287158060b"></a><!-- doxytag: member="Door_control_dll.h::door_control_inps_get" ref="a11bc1420a48bdb3dd5e2c2287158060b" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a11bc1420a48bdb3dd5e2c2287158060b">door_control_inps_get</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get state of the inputs. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0x00...0x0F - bits 0...3 are set to 1 if inputs 1...4 are opened, no contact, 0 if closed</li>
<li>0xA0 - failed WriteFile to serial</li>
<li>0xB0 - incorrect reply from controller </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a664e43f29f02103b4f8afdcfcaa15bd9"></a><!-- doxytag: member="Door_control_dll.h::door_control_lock_set" ref="a664e43f29f02103b4f8afdcfcaa15bd9" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a664e43f29f02103b4f8afdcfcaa15bd9">door_control_lock_set</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Opens or closes the lock. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">int</td><td>state<ul>
<li>0 to close</li>
<li>1 to open </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - failed WriteFile</li>
<li>2 - unable to read acknowledge</li>
<li>4 - incorrect acknowledge </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a69c549adcf652634a994e8cd669c4a00"></a><!-- doxytag: member="Door_control_dll.h::door_control_modem_reset" ref="a69c549adcf652634a994e8cd669c4a00" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a69c549adcf652634a994e8cd669c4a00">door_control_modem_reset</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reset modem. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - failed WriteFile</li>
<li>2 - unable to read acknowledge</li>
<li>4 - incorrect acknowledge </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="ad30cbc8f0c0b51932180f469952eecc1"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_open" ref="ad30cbc8f0c0b51932180f469952eecc1" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#ad30cbc8f0c0b51932180f469952eecc1">door_control_ser_open</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Opens serial port. </p>
<p>port name has to be be set before by <a class="el" href="_door__control__dll_8h.html#a9c4ffa4d06a7a396bf711fd497fd783c" title="Set serial port name.">door_control_ser_set_name(const char *s)</a>;</p>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>1 - failed CreateFile</li>
<li>2 - failed SetCommState </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a9c4ffa4d06a7a396bf711fd497fd783c"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_set_name" ref="a9c4ffa4d06a7a396bf711fd497fd783c" args="(const char *ser_port_name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a9c4ffa4d06a7a396bf711fd497fd783c">door_control_ser_set_name</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>ser_port_name</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set serial port name. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">const</td><td>char *ser_port_name - name of serial port</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a6ce1cce93c0e443449790a3e5460ee52"></a><!-- doxytag: member="Door_control_dll.h::door_control_ser_set_num" ref="a6ce1cce93c0e443449790a3e5460ee52" args="(int port_no)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a6ce1cce93c0e443449790a3e5460ee52">door_control_ser_set_num</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>port_no</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set serial port name by port number. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">int</td><td>port_no - number of serial port</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a6b2909ec14a5aeec9b6036e1670e6cf6"></a><!-- doxytag: member="Door_control_dll.h::door_control_set_brd_ver" ref="a6b2909ec14a5aeec9b6036e1670e6cf6" args="(char board_version)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a6b2909ec14a5aeec9b6036e1670e6cf6">door_control_set_brd_ver</a> </td>
          <td>(</td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>board_version</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set board version. </p>
<p>port has to be opened, board version, 0...255</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">char</td><td>board_version - board version</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>bit 0 is set - unable to write into port</li>
<li>bit 1 is set - unable to read port</li>
<li>bit 2 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="a25c54211a4b569ae9737ae0f271efa14"></a><!-- doxytag: member="Door_control_dll.h::door_control_set_ser_no" ref="a25c54211a4b569ae9737ae0f271efa14" args="(char *buf)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __stdcall <a class="el" href="_door__control__dll_8h.html#a25c54211a4b569ae9737ae0f271efa14">door_control_set_ser_no</a> </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set serial No. </p>
<p>port has to be opened, serial number is 4-bytes string</p>
<p>example: 1234</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">char</td><td>* buf - serial number</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>0 - OK</li>
<li>bit 0 is set - unable to write into port</li>
<li>bit 1 is set - unable to read port</li>
<li>bit 2 is set - incorrect returned message </li>
</ul>
</dd></dl>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Feb 1 2013 14:57:24 for Door_control_dll by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
